macos: only emit popup-layout-changed after initial present
authorChristian Hergert <chergert@redhat.com>
Wed, 14 Oct 2020 23:26:52 +0000 (16:26 -0700)
committerChristian Hergert <chergert@redhat.com>
Wed, 14 Oct 2020 23:28:44 +0000 (16:28 -0700)
Otherwise we risk being re-entrant where GtkPopover will not have a
GdkPopupLayout causing other issues.

gdk/macos/gdkmacospopupsurface.c
gdk/macos/gdkmacossurface.c

index 5729fea338a7ffd00d47dfeb8bec0ce06ce8f5b2..48c2ca02b826bcae46fc0fdd574955f9ba2deca2 100644 (file)
@@ -121,8 +121,6 @@ gdk_macos_popup_surface_present (GdkPopup       *popup,
 
   gdk_macos_popup_surface_layout (self, width, height, layout);
 
-  GDK_MACOS_SURFACE (self)->did_initial_present = TRUE;
-
   if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self)))
     return TRUE;
 
@@ -144,6 +142,8 @@ gdk_macos_popup_surface_present (GdkPopup       *popup,
       show_popup (GDK_MACOS_POPUP_SURFACE (self));
     }
 
+  GDK_MACOS_SURFACE (self)->did_initial_present = TRUE;
+
   return GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
 }
 
index 4b8fedcaf4e963be0f41e2701578d5a097b474bc..ec0fb415608d7e10d7d3f6caf444a42af00a784b 100644 (file)
@@ -84,7 +84,7 @@ _gdk_macos_surface_reposition_children (GdkMacosSurface *self)
         _gdk_macos_popup_surface_reposition (GDK_MACOS_POPUP_SURFACE (child));
     }
 
-  if (GDK_IS_POPUP (self))
+  if (GDK_IS_POPUP (self) && self->did_initial_present)
     g_signal_emit_by_name (self, "popup-layout-changed");
 }